package com.example.covid19.mapper;

import cn.hutool.json.JSONObject;
import com.example.covid19.common.Dto.ReDto;
import com.example.covid19.entity.Recharge;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.covid19.entity.Rechdto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author BaiZhengChun
 * @since 2022-10-29
 */
public interface RechargeMapper extends BaseMapper<Recharge> {
    @Select("SELECT " +
            " recharge.*,  " +
            " `user`.username " +
            "FROM " +
            " recharge " +
            " INNER JOIN " +
            " `user` " +
            " ON  " +
            " recharge.userid = `user`.userid " +
            "WHERE " +
            " recharge.userid = `user`.userid")
    List<ReDto> gcharinf();
    @Select("SELECT " +
            " recharge.*,  " +
            " `user`.username,  " +
            " `user`.money,  " +
            " `user`.balance,  " +
            " `user`.frequency " +
            "FROM " +
            " recharge " +
            " INNER JOIN " +
            " `user` " +
            " ON  " +
            "  recharge.userid = `user`.userid")
    List<Rechdto>  getedch();
    @Select("SELECT " +
            " recharge.*,  " +
            " `user`.username " +
            "FROM " +
            " recharge " +
            " INNER JOIN " +
            " `user` " +
            " ON  " +
            " recharge.userid = `user`.userid " +
            "WHERE " +
            " recharge.userid = `user`.userid "+
            " LIMIT #{pageNo}, #{pagesize} ")
    List<ReDto> gcharinf2(@Param("pageNo")Integer pageNo,@Param("pagesize")Integer pagesize);

}
